package com.isoft.c2team3service2.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.isoft.c2team3service2.entity.PostLike;
import org.apache.ibatis.annotations.Select;

public interface PostLikeMapper extends BaseMapper<PostLike> {
    /**
     * 检查当前登录用户是否点赞某帖子
     * @param currentUserId 当前登录用户ID
     * @param postId 帖子ID
     * @return 1=已点赞，0=未点赞
     */
    @Select("""
        SELECT COUNT(1) FROM post_like 
        WHERE user_id = #{currentUserId} 
          AND post_id = #{postId}
    """)
    Integer checkPostLikeStatus(Integer currentUserId, Integer postId);
}